# !/usr/bin/env python
# -*-coding:utf-8 -*-

"""
# File       : schedule_task.py
# Time       ：2023/8/2 14:28
# Author     ：YangYong
# version    ：python 3.10
# Description：
    定时任务
    schedule task
"""
from public.base_model import Base, db


class ScheduleTask(Base):
    __tablename__ = 'base_schedule_task'

    schedule_task_name = db.Column(db.String(128), unique=True, comment='计划任务名称')
    process_id = db.Column(db.String(255), nullable=False, comment='流程ID')
    process_name = db.Column(db.String(30), nullable=False, comment='流程名称')
    version = db.Column(db.String(128), comment='流程版本')
    process_params = db.Column(db.JSON, comment='流程参数')
    process_config = db.Column(db.JSON, comment='其他配置')
    desc = db.Column(db.String(255), comment='流程描述')
    # 调度关联
    trigger = db.Column(db.Enum('date', 'interval', 'crontab'), comment='调度触发类型')
    schedule_plan = db.Column(db.JSON, comment='调度计划参数')
    schedule_plan_id = db.Column(db.Integer, comment='调度计划ID')
    invalid_start_time = db.Column(db.DateTime, comment='失效开始时间')
    invalid_end_time = db.Column(db.DateTime, comment='失效结束时间')
